﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Heart.Controllers
{
    public class ImageController : Controller
    {
        [HttpPost]
        public void Upload(HttpPostedFileBase upImg)
        {
            string fileName = System.IO.Path.GetFileName(upImg.FileName);
            string filePhysicalPath = Server.MapPath("~/upload/category/" + fileName);
            string picPath = "{}";
            try
            {
                upImg.SaveAs(filePhysicalPath);
                picPath = string.Format("{0}", fileName);
            }
            catch (Exception ex)
            {
                picPath = ex.Message;
            }
            this.HttpContext.Response.Write(picPath);
        }

    }
}
